// #include <stdint.h>
#include <8052.h>
#include "misc.h"

//16位数码管 Digital display
__code unsigned char TBL_DIGITAL_DISPALY[] = {
    0x3f, 0x06, 0x5b, 0x4f,
    0x66, 0x6d, 0x7d, 0x07,
    0x7f, 0x6f, 0x77, 0x7c,
    0x39, 0x5e, 0x79, 0x71};

//循环向左移一位
unsigned char crol(unsigned char data)
{
    unsigned char t1 = data >> 7;
    unsigned char t2 = data << 1;
    return t1 | t2;
}

//延迟函数,单毫秒（左右）
void delay(int tick)
{
    unsigned char a, b;
    while (tick--)
    {
        for (b = 4; b > 0; b--)
            for (a = 100; a > 0; a--)
                ;
    }
}

void beep(int d)
{
    //P2_3为蜂鸣器
    P2_3 = 0;   //开启
    delay(d); //约为dms
    P2_3 = 1;   //关闭
}